import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  CreateDateColumn,
  UpdateDateColumn,
  DeleteDateColumn,
  OneToMany,
} from 'typeorm';
import { User } from './user';

@Entity()
export class Role {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  name: string;

  @Column()
  code: string;

  @OneToMany(() => User, user => user.role) // note: we will create author property in the Photo class below
  users: User[];

  @CreateDateColumn()
  createDate;

  @UpdateDateColumn()
  updateDate;

  @DeleteDateColumn()
  deleteDate;
}
